<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
    <title>线下结算日志</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript" src="${ctxStatic}/echart/echarts.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            test();
        });
        function test() {
            var myChart = echarts.init(document.getElementById("echart"));
            /* require(
             [   'echarts',
             'echarts/chart/line'
             ],
             //回调函数
             DrawEChart
             );*/
            var zhifubao=${zhifubao};
            var weixin=${weixin};
            var xianjin=${xianjin};
            var wuye=${wuye};
            var maque=${maque};
            var other=${other};
            var maxMoney=${maxMoney};
            /*$.ajax({
                url: '${ctx}/sys/tbShopProduct/getHistroyPicture',
                data: {},
                dataType: 'json',
                cache: false,
                async: false,
                success: function (data) {
                    if (data.length > 0) {
                        var item=data[0];
                        zhifubao=item.zhifubao;
                        weixin=item.weixin;
                        xianjin=item.xianjin;
                        wuye=item.wuye;
                        maque=item.maqu;
                        maxMoney=item.maxMoney;
                    } else {
                        alert("没有结算信息");
                    }

                }
            });*/
            var option = {
                title : {
                    text: '不同支付方式的营业额',
                    subtext: 'tb_shoping_order_log表',
                    x:'center'
                },
                tooltip : {
                    trigger: 'item',
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
                legend: {//1 支付宝 2微信 3现金 4物业钱包 5麻雀钱包 0 其他
                    orient : 'vertical',
                    x : 'left',
                    data:['支付宝','微信','现金','物业钱包','麻雀钱包','其他']
                },
                toolbox: {
                    show : true,
                    feature : {
                        mark : {show: true},
                        dataView : {show: true, readOnly: false},
                        magicType : {
                            show: true,
                            type: ['pie', 'funnel'],
                            option: {
                                funnel: {
                                    x: '25%',
                                    width: '50%',
                                    funnelAlign: 'left',
                                    max: maxMoney
                                }
                            }
                        },
                        restore : {show: true},
                        saveAsImage : {show: true}
                    }
                },
                calculable : true,
                series : [
                    {
                        name:'访问来源',
                        type:'pie',
                        radius : '55%',
                        center: ['50%', '60%'],
                        data:[//'支付宝','微信','现金','物业钱包','麻雀钱包','其他'
                            {value:zhifubao, name:'支付宝'},
                            {value:weixin, name:'微信'},
                            {value:xianjin, name:'现金'},
                            {value:wuye, name:'物业钱包'},
                            {value:maque, name:'麻雀钱包'},
                            {value:other, name:'其他'}
                        ]
                    }
                ]
            };
            myChart.setOption(option);


        }

    </script>
    <script type="text/javascript">
        function page(n, s) {
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            $("#searchForm").attr("action", "${ctx}/sys/tbShopProduct/offlineShoppingLog");
            $("#searchForm").submit();
            return false;
        }
    </script>
    <style>
        .pic1{
            width:400px;
            height:400px;
            margin: 20px auto;
             }
    </style>
</head>
<body>
<ul class="nav nav-tabs">
    <li class="active"><a href="#">线下结算日志</a></li>
</ul>

<div id="echart" class="pic1"></div>
<form:form id="searchForm" modelAttribute="orderLog" action="${ctx}/sys/tbShopProduct/offlineShoppingLog" method="post" class="breadcrumb form-search">
    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
    <ul class="ul-form">
       <li><label>时间范围：</label>
            <input name="startTime" type="text" readonly="readonly" maxlength="20" class="input-mini Wdate"
                   value="<fmt:formatDate value="${orderLog.startTime}" pattern="yyyy-MM-dd"/>"
                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>--
            <input name="endTime" type="text" readonly="readonly" maxlength="20" class="input-mini Wdate"
                   value="<fmt:formatDate value="${orderLog.endTime}" pattern="yyyy-MM-dd"/>"
                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
        </li>
        <li><label>订单号：</label>
            <input name="orderNum" value="${orderLog.orderNum}" htmlEscape="false" maxlength="50" class="input-medium"/>
        </li>
           <li><label>支付方式：</label>
               <select name="payName" class="input-medium">
                   <option value="-1" selected>请选择</option>
                   <option value="1" <c:if test="${orderLog.payName==1}" > selected</c:if> >支付宝</option>
                   <option value="2" <c:if test="${orderLog.payName==2}"> selected</c:if> >微信</option>
                   <option value="3" <c:if test="${orderLog.payName==3}"> selected</c:if> >现金</option>
                   <option value="4" <c:if test="${orderLog.payName==4}"> selected</c:if> >物业钱包</option>
                   <option value="5" <c:if test="${orderLog.payName==5}"> selected</c:if> >麻雀钱包</option>
                   <option value="0" <c:if test="${orderLog.payName==0}"> selected</c:if> >其他</option>
               </select>
           </li>
           <li><label>营业额：</label>
               <input name="orderSum" value="${orderLog.orderSum}" type="number" htmlEscape="false" maxlength="50" min="0" class="input-medium"/>
           </li>
        <li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
        <li class="clearfix"></li>
    </ul>
</form:form>

<sys:message content="${message}"/>
<span><font style="color: #00A6C7">${message1}</font></span>
<table id="contentTable" class="table table-striped table-bordered table-condensed">
    <thead>
    <tr>
        <th>订单编号</th>
        <th>应付金额</th>
        <th>实付金额</th>
        <th>找零</th>
        <th>支付方式</th>
        <th>创建时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${orderLogPage.list}" var="order">
        <tr>
            <td>${order.orderNum}</td>
            <td>${order.orderSum}</td>
            <td>${order.giveMoney}</td>
            <td>${order.payMoney}</td>
            <td>${order.payName}</td>
            <td><fmt:formatDate value="${order.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
            <td><a href="${ctx}/sys/tbShopProduct/offineShoppingOrderInfo?orderId=${order.id}">查看</a></td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<div class="pagination">${page}</div>


</body>

</html>